/**
 * @Description: 全局自动注册组件，前缀加上 global-
 * @Author BPF
 * @create 2021/8/20 21:49
 */
export default {
  install: (app, options) => {
    console.log(options)
    const prefix = 'global-'
    const components = import.meta.globEager('/src/components/**/*.vue')
    Object.keys(components).forEach(key => {
      const _default = components[key].default
      if (_default?.name) {
        const name = _default?.name?.includes?.(prefix) ? _default?.name : `${prefix}${_default?.name}`
        app.component(name, _default)
      }
    })
  }
}
